<template>
  <!-- 车载调试报告 -->
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true">
      <el-form-item class="item-class" label="整机条码:" prop="snCode">
        <el-input v-model="queryParams.snCode" placeholder="请输入整机条码" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item class="item-class" label="产品型号:" prop="productModel">
        <el-input v-model="queryParams.productModel" placeholder="请输入产品型号" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
      <el-form-item class="item-class" label="产品类型:" prop="productType">
        <el-input v-model="queryParams.productType" placeholder="请输入产品类型" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>

      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜 索</el-button>
      </el-form-item>

      <el-row :gutter="10" class="mb8">
        <el-col :span="1.5">
          <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" v-hasPermi="['produce:debugReport:add']">新增</el-button>
        </el-col>
        <el-col :span="1.5">
          <el-button type="warning" icon="el-icon-download" size="mini" @click="handleExport" v-hasPermi="['produce:debugReport:export']">导出</el-button>
        </el-col>
      </el-row>

      <!-- 添加或修改检测项对话框 -->
      <el-dialog :title="title" :visible.sync="open" width="1550px" append-to-body @close="cancel">
        <div class="contentDiv">
          <div><el-button type="warning" icon="el-icon-download" size="mini" @click="handleDetailExport">导出</el-button></div>
          <el-form ref="form" class="perForm" :model="form" label-width="120px" size="medium" :inline="true" style="margin-top: 30px">
            <el-form-item label="整机条码:" prop="caseId">
              <el-input id="snCode-input" v-model="form.snCode" placeholder="请输入整机条码" @input="snCodebutton" clearable @keyup.enter.native="handleQuery" />
            </el-form-item>
            <el-form-item label="产线号:" prop="productionLine">
              <el-input v-model="form.productionLine" :disabled="true" />
            </el-form-item>
            <el-form-item label="老化房号:" prop="burnRoom">
              <el-input v-model="form.burnRoom" :disabled="true" />
            </el-form-item>
            <el-form-item label="调试台号:" prop="debugStation">
              <el-input v-model="form.debugStation" :disabled="true" />
            </el-form-item>
            <el-form-item label="产品型号:" prop="productModel">
              <el-input v-model="form.productModel" :disabled="true" />
            </el-form-item>
            <el-form-item label="生产批号:" prop="batch">
              <el-input v-model="form.batch" :disabled="true" />
            </el-form-item>
            <el-form-item label="质检员:" prop="qualityInspector">
              <el-input v-model="form.qualityInspector" :disabled="true" />
            </el-form-item>
            <el-form-item label="老化人员:" prop="burnStaff">
              <el-input v-model="form.burnStaff" :disabled="true" />
            </el-form-item>
            <el-form-item label="调试人员:" prop="debugStaff">
              <el-input v-model="form.debugStaff" :disabled="true" />
            </el-form-item>
            <el-form-item label="客户名称:" prop="customerName">
              <el-input v-model="form.customerName" :disabled="true" />
            </el-form-item>
            <el-form-item label="产品类型:" prop="productType">
              <el-input v-model="form.productType" :disabled="true" />
            </el-form-item>
            <el-form-item label="质检结果:" prop="qualityResults">
              <el-input v-model="form.qualityResults" :disabled="true" />
            </el-form-item>
            <el-form-item label="老化结果:" prop="burnResults">
              <el-input v-model="form.burnResults" :disabled="true" />
            </el-form-item>
            <el-form-item label="调试结果:" prop="debugResults">
              <el-input v-model="form.debugResults" :disabled="true" />
            </el-form-item>
          </el-form>
          <!-- 组装质检信息 -->
          <el-tag size="large" style="font-size: 20px;margin-top: 20px;">组装质检信息</el-tag>
          <el-table v-loading="loading" :data="dbDebugAssembleInfoList" width="80%" style="margin-top: 20px;">
            <el-table-column label="物料编码" align="center" prop="materialCode" />
            <el-table-column label="物料名称" align="center" prop="materialName" />
            <el-table-column label="物料规格" align="center" prop="materialSpecs" />
            <el-table-column label="批次流水号" align="center" prop="batchNumber" />
            <el-table-column label="安装时间" align="center" prop="installTime" />
            <el-table-column label="装配员" align="center" prop="assembleStaff" />
          </el-table>
          <!--安规测试结果 -->
          <el-tag size="large" style="font-size: 20px;margin-top: 20px;">安规测试结果</el-tag>
          <el-form ref="pressureTest" class="perForm" :model="pressureTest" label-width="120px" size="medium" :inline="true" style="margin-top: 20px">
            <el-form-item label="耐压值上限(mA)" prop="pressurizationUpperLimit">
              <el-input v-model="pressureTest.pressurizationUpperLimit" />
            </el-form-item>
            <el-form-item label="耐压值下限(mA)" prop="pressurizationLowerLimit">
              <el-input v-model="pressureTest.pressurizationLowerLimit" />
            </el-form-item>
            <el-form-item label="耐压值实测(mA)" prop="pressurizationTextValue">
              <el-input v-model="pressureTest.pressurizationTextValue" />
            </el-form-item>
            <el-form-item label="绝缘值上限(兆欧)" prop="insulationUpperLimit">
              <el-input v-model="pressureTest.insulationUpperLimit" />
            </el-form-item>
            <el-form-item label="绝缘值下限(兆欧)" prop="insulationLowerLimit">
              <el-input v-model="pressureTest.insulationLowerLimit" />
            </el-form-item>
            <el-form-item label="绝缘值实测(兆欧)" prop="insulationTestValue">
              <el-input v-model="pressureTest.insulationTestValue" />
            </el-form-item>
            <el-form-item label="安规测试结果" prop="safetyTestResult">
              <el-input v-model="pressureTest.safetyTestResult" />
            </el-form-item>
            <el-form-item label="安规测试时间" prop="safetyTestTime">
              <el-input v-model="pressureTest.safetyTestTime" />
            </el-form-item>
            <el-form-item label="测试员" prop="safetyTestStaff">
              <el-input v-model="pressureTest.safetyTestStaff" />
            </el-form-item>
          </el-form>
          <!--灌流测试结果 -->
          <el-tag size="large" style="font-size: 20px;margin-top: 20px;">灌流测试结果</el-tag>
          <el-form class="perForm" :model="pressureTest" label-width="120px" size="medium" :inline="true" style="margin-top: 20px">
            <el-form-item label="气泵Q_U" prop="qu">
              <el-input v-model="pressureTest.qu" />
            </el-form-item>
            <el-form-item label="气泵Q_V" prop="qv">
              <el-input v-model="pressureTest.qv" />
            </el-form-item>
            <el-form-item label="气泵Q_W" prop="qw">
              <el-input v-model="pressureTest.qw" />
            </el-form-item>
            <el-form-item label="油泵Y_U" prop="yu">
              <el-input v-model="pressureTest.yu" />
            </el-form-item>
            <el-form-item label="油泵Y_V" prop="yv">
              <el-input v-model="pressureTest.yv" />
            </el-form-item>
            <el-form-item label="油泵Y_W" prop="yw">
              <el-input v-model="pressureTest.yw" />
            </el-form-item>
            <el-form-item label="DCDC_V" prop="dcdcV">
              <el-input v-model="pressureTest.dcdcV" />
            </el-form-item>
            <el-form-item label="灌流测试结果" prop="perfusionTestResult">
              <el-input v-model="pressureTest.perfusionTestResult" />
            </el-form-item>
            <el-form-item label="测试时间" prop="perfusionTestTime">
              <el-input v-model="pressureTest.perfusionTestTime" />
            </el-form-item>
            <el-form-item label="测试员" prop="perfusionTestStaff">
              <el-input v-model="pressureTest.perfusionTestStaff" />
            </el-form-item>
          </el-form>

          <!--气密测试结果 -->
          <el-tag size="large" style="font-size: 20px;margin-top: 20px;">气密测试结果</el-tag>
          <el-form class="airtight" :model="pressureTest" label-width="120px" size="medium" :inline="true" style="margin-top: 20px">
            <el-form-item label="气密测试值(pa)" prop="airtightnessTestResult">
              <el-input v-model="pressureTest.airtightnessTestResult" />
            </el-form-item>
          </el-form>

          <!-- 老化信息 -->
          <el-tag size="large" style="font-size: 20px;margin-top: 20px;">老化信息</el-tag>
          <el-table v-loading="loading" :data="dbDebugBurnMalfunctionList" width="80%" style="margin-top: 20px;">
            <el-table-column label="报警时间" align="center" prop="alarmTime" />
            <el-table-column label="参数名称" align="center" prop="parameterName" />
            <el-table-column label="参数值" align="center" prop="parameterValue" />
            <el-table-column label="故障等级" align="center" prop="malfunctionGrade" />
            <el-table-column label="故障状态" align="center" prop="malfunctionStatus" />
          </el-table>
          <el-table v-loading="loading" :data="dbDebugBurnInfoList" width="80%" style="margin-top: 20px;">
            <el-table-column label="时间" align="center" prop="time" />
            <el-table-column label="DCDC电压" align="center" prop="dcdcVoltage" />
            <el-table-column label="DCDC电流" align="center" prop="dcdcAm" />
            <el-table-column label="DCAC1电压" align="center" prop="dcac1Voltage" />
            <el-table-column label="DCAC1电流" align="center" prop="dcac1Am" />
            <el-table-column label="DCAC2电压" align="center" prop="dcac2Voltage" />
            <el-table-column label="DCAC2电流" align="center" prop="dcac2Am" />
            <el-table-column label="电驱电压" align="center" prop="electricDriveVoltage" />
            <el-table-column label="电驱电流" align="center" prop="electricDriveAm" />
            <el-table-column label="充电机电流" align="center" prop="chargerAm" />
          </el-table>

          <!-- 调试信息 -->
          <el-tag size="large" style="font-size: 20px;margin-top: 20px;">调试信息</el-tag>
          <el-form ref="dbDebugInfo" class="dbDebugInfo" :model="dbDebugInfo" label-width="150px" size="medium" :inline="true" style="margin-top: 20px">
            <el-form-item label="控制电压(V):" prop="controlVoltage">
              <el-input v-model="dbDebugInfo.controlVoltage" :disabled="true" />
            </el-form-item>
            <el-form-item label="报警偏差电流DCDC:" prop="warnAmDcdc">
              <el-input v-model="dbDebugInfo.warnAmDcdc" :disabled="true" />
            </el-form-item>
            <el-form-item label="报警偏差电流DCAC:" prop="warnAmDcac">
              <el-input v-model="dbDebugInfo.warnAmDcac" :disabled="true" />
            </el-form-item>
            <el-form-item label="报警偏差电压DCDC:" prop="warnVoltageDcdc">
              <el-input v-model="dbDebugInfo.warnVoltageDcdc" :disabled="true" />
            </el-form-item>
            <el-form-item label="报警偏差电压DCAC:" prop="warnVoltageDcac">
              <el-input v-model="dbDebugInfo.warnVoltageDcac" :disabled="true" />
            </el-form-item>
            <el-form-item label="故障偏差电流DCDC:" prop="faultAmDcdc">
              <el-input v-model="dbDebugInfo.faultAmDcdc" :disabled="true" />
            </el-form-item>
            <el-form-item label="故障偏差电流DCAC:" prop="faultAmDcac">
              <el-input v-model="dbDebugInfo.faultAmDcac" :disabled="true" />
            </el-form-item>
            <el-form-item label="故障偏差电压DCDC:" prop="faultVoltageDcdc">
              <el-input v-model="dbDebugInfo.faultVoltageDcdc" :disabled="true" />
            </el-form-item>
            <el-form-item label="故障偏差电压DCAC:" prop="faultVoltageDcac">
              <el-input v-model="dbDebugInfo.faultVoltageDcac" :disabled="true" />
            </el-form-item>
          </el-form>

          <!-- <el-form
            ref="fault"
            class="fault"
            :model="fault"
            label-width="120px"
            size="medium"
            :inline="true"
            style="margin-top:20px"
          >
            <el-form-item label="调试日期" prop="testedTime">
              <el-input v-model="form.testedTime" :disabled="true" />
            </el-form-item>
            <el-form-item label="故障偏差电流" prop="A">
              <el-input v-model="fault.A" :disabled="true" />
            </el-form-item>
            <el-form-item label="故障偏差电压" prop="V">
              <el-input v-model="fault.V" :disabled="true" />
            </el-form-item>
          </el-form> -->

          <el-table :data="dbDebugInfoLineList" width="80%" style="margin-top: 20px;">
            <el-table-column label="采样时间" align="center" prop="samplingTime" />
            <el-table-column label="调试模块" align="center" prop="debugModule" />
            <el-table-column label="调试步骤" align="center" prop="debugStep" />
            <el-table-column label="母线电压" align="center" prop="generatrixVoltage" />
            <el-table-column label="PLC电压(V)" align="center" prop="plcVoltage" />
            <el-table-column label="PLC电流(A)" align="center" prop="plcAm" />
            <el-table-column label="CAN电压(V)" align="center" prop="camVoltage" />
            <el-table-column label="CAN电流(A)" align="center" prop="camAm" />
            <el-table-column label="电压偏差(%)" align="center" prop="voltageDeviation" />
            <el-table-column label="电流偏差(%)" align="center" prop="amDeviation" />
          </el-table>

          <el-table v-loading="loading" :data="dbDebugInfoMalfunctionList" width="80%" style="margin-top: 20px;">
            <el-table-column label="调试时间" align="center" prop="debugTime" />
            <el-table-column label="调试模块" align="center" prop="debugModule" />
            <el-table-column label="调试步骤" align="center" prop="debugStep" />
            <el-table-column label="故障类型" align="center" prop="malfunctionType" />
            <el-table-column label="PLC值" align="center" prop="plcValue" />
            <el-table-column label="CAN值" align="center" prop="camValue" />
            <el-table-column label="PLC/CAN偏差" align="center" prop="plcCanDeviation" />
            <el-table-column label="说明" align="center" prop="illustrate" />
          </el-table>

          <el-table v-loading="loading" :data="dbDebugInfoDemandList" width="80%" style="margin-top: 20px;">
            <el-table-column label="充电模式" align="center" prop="chargeMode" />
            <el-table-column label="控制电压" align="center" prop="controlVoltage" />
            <el-table-column label="母线电压" align="center" prop="busVoltage" />
            <el-table-column label="电压需求" align="center" prop="voltageDemand" />
            <el-table-column label="电流需求" align="center" prop="currentDemand" />
            <el-table-column label="PLC电压(V)" align="center" prop="plcVoltage" />
            <el-table-column label="PLC电流(A)" align="center" prop="plcCurrent" />
            <el-table-column label="CAN电压(V)" align="center" prop="canVoltage" />
            <el-table-column label="CAN电流(A)" align="center" prop="canCurrent" />
            <el-table-column label="时间" align="center" prop="time" />
          </el-table>

          <el-tag size="large" style="font-size: 20px;margin-top: 20px;">维修记录</el-tag>
          <el-table v-loading="loading" :data="dbDebugMaintenanceRecordList" width="80%" style="margin-top: 20px;">
            <el-table-column label="序号" align="center" width="50px">
              <template slot-scope="scope">
                <span>{{ scope.$index + 1 }}</span>
              </template>
            </el-table-column>
            <el-table-column label="维修时间" align="center" prop="maintenanceTime" />
            <el-table-column label="维修人" align="center" prop="maintenanceStaff" />
            <el-table-column label="送修时间" align="center" prop="sendRepairTime" />
            <el-table-column label="送修人" align="center" prop="sendRepairStaff" />
            <el-table-column label="故障类型" align="center" prop="malfunctionType" />
            <el-table-column label="故障定位" align="center" prop="malfunctionLocation" />
            <el-table-column label="失效分析人" align="center" prop="pfmeaStaff" />
            <el-table-column label="装配线" align="center" prop="assemblyLine" />
          </el-table>

          <!-- <el-tag size="large" style="font-size: 20px;margin-top: 20px;">工装机调试数据</el-tag>
          <el-table v-loading="loading" :data="dbData" width="80%" style="margin-top: 20px;">
            <el-table-column label="序号" align="center" width="50px">
              <template slot-scope="scope">
                <span>{{ scope.$index + 1 }}</span>
              </template>
            </el-table-column>
            <el-table-column label="指标名称" align="center" prop="tagName" />
            <el-table-column label="指标值" align="center" prop="tagValue" />
          </el-table> -->
        </div>

        <div slot="footer" class="dialog-footer">
          <el-button type="primary" @click="submitForm">确 定</el-button>
          <el-button @click="cancel">取 消</el-button>
        </div>
      </el-dialog>
    </el-form>

    <!-- 车载调试报告的table -->
    <el-table v-loading="loading" :data="communList">
      <el-table-column label="序号" align="center" width="50px">
        <template slot-scope="scope">
          <span>{{ scope.$index + 1 }}</span>
        </template>
      </el-table-column>
      <el-table-column label="整机条码" align="center" prop="snCode" />
      <el-table-column label="产品型号" align="center" prop="productModel" />
      <el-table-column label="产品类型" align="center" prop="productType" />
      <el-table-column label="产线号" align="center" prop="productionLine" />
      <el-table-column label="生产批号" align="center" prop="batch" />
      <el-table-column label="客户名称" align="center" prop="customerName" />
      <el-table-column label="质检员" align="center" prop="qualityInspector" />
      <el-table-column label="质检结果" align="center" prop="qualityResults" />
      <el-table-column label="老化房号" align="center" prop="burnRoom" />
      <el-table-column label="老化人员" align="center" prop="burnStaff" />
      <el-table-column label="老化结果" align="center" prop="burnResults" />
      <el-table-column label="调试台号" align="center" prop="debugStation" />
      <el-table-column label="调试人员" align="center" prop="debugStaff" />
      <el-table-column label="调试结果" align="center" prop="debugResults" />
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" v-hasPermi="['produce:debugReport:edit']">修改</el-button>
          <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" v-hasPermi="['produce:debugReport:remove']">删除</el-button>
        </template>
      </el-table-column>
    </el-table>

    <pagination :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />
  </div>
</template>
  
  <script>
import {
  getReport2,
  subReport,
  deleteReport,
  reportAll,
  subDebug,
  reportAllfind,
  debugUpdate
} from "@/api/mes/pro/vehicleMode";
export default {
  name: "VehicleMode",
  data() {
    return {
      // 遮罩层
      loading: false,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 生产工单表格数据
      checkoutList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        productName: null,
        specification: null,
        productBarcode: null,
      },
      // 表单参数
      form: {
        productName: "",
        specification: "",
        productBarcode: "",
        inspectDate: "",
        inspector: "",
        examineDate: "",
        auditor: "",
        checkResult: "",
      },
      // 表单校验
      rules: {},
      //   调试信息
      dbDebugInfo: {},
      fault: {},
      //tableList
      communList: [],
      // 模板列表
      templateList: [
        {
          inspectionItems: "外观",
          technical: "整机外表面应平整，无明显的划伤",
          measuredValue: "",
          checkResult: "",
        },
        {
          inspectionItems: "外观",
          technical: "铭牌、标志安装应端正牢固，字迹清晰",
          checkResult: "",
        },
        {
          inspectionItems: "外观",
          technical: "零部件应紧固可靠，无锈蚀、毛刺、裂纹等缺陷和损伤",
          checkResult: "",
        },
        {
          inspectionItems: "性能参数",
          technical:
            "DC-AC(油泵);三相输出电压:AC196V;电压波动<5%;电压不平衡度<1%;三相输出电流:8A;电流不平衡度<=2%",
          checkResult: "",
        },
        {
          inspectionItems: "性能参数",
          technical:
            "DC-AC(气泵);三相输出电压:AC300V;电压波动<5%;电压不平衡度<1%;三相输出电流:9.5A;电流不平衡度<=2%",
          checkResult: "",
        },
        {
          inspectionItems: "性能参数",
          technical: "DC-DC输出电压:27.5V±0.3V;",
          checkResult: "",
        },
        {
          inspectionItems: "参数校正",
          technical: "实测母线电压与显示电压误差不超过±2%;",
          checkResult: "",
        },
        {
          inspectionItems: "参数校正",
          technical: "输出电流实测与显示误差不超过±5%:",
          checkResult: "",
        },
        {
          inspectionItems: "保护功能",
          technical: "过压保护、过流保护、欠压保护能正常动作;",
          checkResult: "",
        },
        {
          inspectionItems: "绝缘阻抗",
          technical: "DC1000V 持续60S,测试电阻>20兆欧:",
          checkResult: "",
        },
        {
          inspectionItems: "耐压测试",
          technical: "DC2000V 持续60S,测试漏电流<10mA;",
          checkResult: "",
        },
        {
          inspectionItems: "老化测试",
          technical: "60C测试环境下正常运行4H无故障;",
          checkResult: "",
        },
        {
          inspectionItems: "CAN通讯",
          technical: "通讯与实际要求一致;",
          checkResult: "",
        },
        {
          inspectionItems: "产品尺寸",
          technical: "产品外形尺寸与外形图纸要求一致;",
          checkResult: "",
        },
        {
          inspectionItems: "气密测试",
          technical: "-25P<=测试值<=25PA;",
          checkResult: "",
        },
      ],
      loading1: false,
      //组装信息的table List
      dbDebugAssembleInfoList: [],
      //安规,灌流，气密测试结果
      pressureTest: {},
      //气密测试结果
      airtight: {},
      //老化信息的table
      dbDebugBurnMalfunctionList: [],
      dbDebugBurnInfoList: [],
      //调试信息table1
      dbDebugInfoLineList: [],
      //调试信息table2
      dbDebugInfoMalfunctionList: [],
      //调试信息table3
      dbDebugInfoDemandList: [],
      //维修记录
      dbDebugMaintenanceRecordList: [],
      //工装机调试数据
      dbData: [],
    };
  },
  created() {
    this.getList();
  },
  methods: {
    handleDetailExport() {
      this.download(
        "/mes/debug/debug/exportDetails",
        {
          ...this.form,
        },
        `车载调试报告明细.xlsx`,
      );
    },
    handleExport() {
      this.download(
        "/mes/debug/debug/export",
        {
          ...this.queryParams,
        },
        `车载调试报告列表.xlsx`,
      );
    },
    /** 查询生产工单列表 */
    getList() {
      getReport2(this.queryParams).then((res) => {
        console.log(res, "查询的res");
        if (res.code == 200) {
          //车载调试报告的table
          this.communList = res.rows;
        }
      });
    },
    //整机条码扫码函数
    snCodebutton(e) {
      var myInputOrder = document.getElementById("snCode-input");
      myInputOrder.onkeydown = (even) => {
        if (even.key == "Enter") {
          console.log(e, "eee");
          this.itemJudge(e);
        }
      };
    },
    //根据整机条码查询函数
    itemJudge(e) {
      //新增是0,修改是1
      if (this.form.id != null) {
        this.form.type = 1
      } else {
        this.form.type = 0
      }
      let param = {
        snCode: e,
        type: this.form.type
      }
      reportAll(param).then(res => {
        console.log(res, "根据sncode查询的res");
        if (res.code == 200) {
          this.form = res.data.dbDebug || {};
          this.pressureTest = res.data.dbDebugTextResult || {};
          this.dbDebugAssembleInfoList = res.data.dbDebugAssembleInfoList || [];
          this.dbDebugBurnMalfunctionList = res.data.dbDebugBurnMalfunctionList || [];
          this.dbDebugBurnInfoList = res.data.dbDebugBurnInfoList || [];
          this.dbDebugInfo = res.data.dbDebugInfo;
          this.dbDebugInfoLineList = res.data.dbDebugInfoLineList;
          this.dbDebugInfoMalfunctionList = res.data.dbDebugInfoMalfunctionList;
          this.dbDebugInfoDemandList = res.data.dbDebugInfoDemandList;
          this.dbDebugMaintenanceRecordList = res.data.dbDebugMaintenanceRecordList;
          //工装机调试信息
          // this.dbData = res.data.dbData
          this.loading = false;
          this.$modal.msgSuccess(res.msg)
        } else {
          this.$modal.msgError(res.msg)
        }
      });
    },
    // 表单重置
    reset() {
      this.form = {
        interflowId: null,
        productName: "",
        specification: "",
        inspectDate: "",
        inspector: "",
        examineDate: "",
        auditor: "",
        checkResult: "",
      };
      //清空 组装质检信息
      this.dbDebugAssembleInfoList = []
      //安规\灌流、气密测试结果
      this.pressureTest = {}
      //清空 老化信息 
      this.dbDebugBurnMalfunctionList = []
      this.dbDebugBurnInfoList = []
      //清空 调试信息
      this.dbDebugInfo = {}
      this.dbDebugInfoLineList = []
      this.dbDebugInfoMalfunctionList = []
      this.dbDebugInfoDemandList = []
      this.dbDebugMaintenanceRecordList = []
      this.loading1 = false;
      this.resetForm("form");
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    /** 搜索 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加车载调试报告";
      //调用 老化信息的查询
    },
    /** 车载调试报告的修改按钮操作 */
    handleUpdate(row) {
      console.log(row, '修改的row');
      this.reset();
      this.form = { ...row }
      this.form.type = 1
      this.open = true;
      this.title = "修改车载调试报告";
      reportAllfind(row.snCode).then(res => {
        if (res.code == 200) {
          this.form = res.data.dbDebug || {};
          this.pressureTest = res.data.dbDebugTextResult || {};
          this.dbDebugAssembleInfoList = res.data.dbDebugAssembleInfoList || [];
          this.dbDebugBurnMalfunctionList = res.data.dbDebugBurnMalfunctionList || [];
          this.dbDebugBurnInfoList = res.data.dbDebugBurnInfoList || [];
          this.dbDebugInfo = res.data.dbDebugInfo;
          this.dbDebugInfoLineList = res.data.dbDebugInfoLineList;
          this.dbDebugInfoMalfunctionList = res.data.dbDebugInfoMalfunctionList;
          this.dbDebugInfoDemandList = res.data.dbDebugInfoDemandList;
          this.dbDebugMaintenanceRecordList = res.data.dbDebugMaintenanceRecordList;
          //工装机调试信息
          // this.dbData = res.data.dbData
          this.loading = false;
          // this.$modal.msgSuccess(res.msg)
        } else {
          this.$modal.msgError(res.msg)
        }
      })
    },

    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate((valid) => {
        if (valid) {
          console.log(this.form, 'row的form');
          if (this.form.id !== null) {
            //修改
            let param = {
              dbDebug: this.form,
              dbDebugAssembleInfoList: this.dbDebugAssembleInfoList,
              dbDebugBurnInfoList: this.dbDebugBurnInfoList,
              dbDebugBurnMalfunctionList: this.dbDebugBurnMalfunctionList,
              dbDebugInfo: this.dbDebugInfo,
              dbDebugInfoDemandList: this.dbDebugInfoDemandList,
              dbDebugInfoLineList: this.dbDebugInfoLineList,
              dbDebugInfoMalfunctionList: this.dbDebugInfoMalfunctionList,
              dbDebugMaintenanceRecordList: this.dbDebugMaintenanceRecordList,
              dbDebugTextResult: this.pressureTest,
            }
            debugUpdate(param).then(res => {
              if (res.code == 200) {
                this.$modal.msgSuccess("修改成功")
                this.open = false
                this.getList()
              } else {
                this.$modal.msgSuccess(res.msg)
              }
            })
          } else {
            //新增的保存 
            let param = {
              dbDebug: this.form,
              dbDebugAssembleInfoList: this.dbDebugAssembleInfoList,
              dbDebugBurnInfoList: this.dbDebugBurnInfoList,
              dbDebugBurnMalfunctionList: this.dbDebugBurnMalfunctionList,
              dbDebugInfo: this.dbDebugInfo,
              dbDebugInfoDemandList: this.dbDebugInfoDemandList,
              dbDebugInfoLineList: this.dbDebugInfoLineList,
              dbDebugInfoMalfunctionList: this.dbDebugInfoMalfunctionList,
              dbDebugMaintenanceRecordList: this.dbDebugMaintenanceRecordList,
              dbDebugTextResult: this.pressureTest,
            }
            subDebug(param).then(res => {
              console.log(res, '新增的res');
              if (res.code == 200) {
                this.$modal.msgSuccess("新增成功")
                this.open = false
                this.getList()
              } else {
                this.$modal.msgSuccess(res.msg)
              }
            })
          }
        }
      });
    },
    /** 车载调试报告的删除按钮操作 */
    handleDelete(row) {
      const snCodes = row.snCode || this.ids;
      this.$modal
        .confirm('是否确认删除整机条码为"' + snCodes + '"的数据项？')
        .then(function () {
          return deleteReport(snCodes);
        })
        .then(() => {
          this.getList();
          this.$modal.msgSuccess("删除成功");
        })
        .catch(() => { });
    },
  },
};
</script>
    